#! /bin/bash
SERVER_DIR=$1
 echo "Startup service.."
    tId=`ps -ef|grep "${SERVER_DIR}/bin/"|grep -v "grep"|awk '{print $2}'`
    if [ ${tId:=0} -ne 0 ] 
    then
       echo "failure: it's already startup,please stop first.[Failed]"
    else
       ${SERVER_DIR}/bin/startup.sh
       sleep 2 
       tId=`ps -ef|grep "${SERVER_DIR}/bin/"|grep -v "grep"|awk '{print $2}'`
       if [ ${tId:=0 } -eq 0 ]
       then 
           echo "failure: See details on ${SERVER_DIR}/logs/catalina.out. [Failed]"
       else
           echo "success [OK]"
       fi
    fi
